<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<title>接待规则</title>
	<link rel="stylesheet" href="/layui/css/layui.css">
	<style type="text/css">
		body{
			background: #e9e9e9;
		}
		.public_form_content{
			padding: 24px 40px 24px 0;
			background: #fff;
			border: 1px solid #e9e9e9;
			margin-bottom: 8px;
		}
		.public_form_List{
			margin-bottom: 10px;
		}
		.public_form_List:last-child{
			margin-bottom: 0px;
		}
		.public_title_container{
			height: 54px;
			padding: 0 20px;
			font-size: 14px;
			display: flex;
			align-items: center;
			background: #f9f9f9;
			border-bottom: 1px solid #f0f0f0;
			justify-content: space-between;
		}
		.public_title_container a{
			fill: #999;
		}
		/*公共头部带搜索*/
		.public_container{
			margin: 20px;
			background: #fff;
		} 
		/*公共表单部分*/
		.public_form_container{
			padding: 20px 20px 40px 20px;
		}
	</style>
</head>
<body>
	<form class="layui-form" action="">
		<div class="public_container">
			<div class="public_form_container">
				<div class="public_content">
					<div class="public_title_container">
						<p>接待规则模式设置，两项只能开启一项</p>
					</div>
				</div>
				<div class="public_form_content">
					<div class="public_form_List">
					  	<div class="layui-form-item">
					    <label class="layui-form-label">智能助手：</label>
					    	<div class="layui-input-block">
					      		<input type="radio" name="noopsyche" value="1" lay-filter="noopsyche" title="开启" {if $regulation->noopsyche == 1} checked{/if} {if !$regulation->id}checked{/if}>
					      		<input type="radio" name="noopsyche" value="2" id="noopsyche" lay-filter="noopsyche" title="关闭" {if $regulation->noopsyche == 2} checked{/if}>
					    	</div>
					  	</div>
					</div>
					<!-- <div class="public_form_List">
					  	<div class="layui-form-item">
					    <label class="layui-form-label">排队模式：</label>
					    	<div class="layui-input-block">
					      		<input type="radio" name="queue" value="1" lay-filter="queue" title="开启" {if $regulation->queue == 1} checked{/if}>
					      		<input type="radio" name="queue" value="2" id="queue" lay-filter="queue" title="关闭" {if $regulation->queue == 2} checked{/if} {if !$regulation->id}checked{/if}>
					    	</div>
					  	</div>
					</div> -->
					<div class="public_form_List">
					  	<div class="layui-form-item">
					    <label class="layui-form-label">人工模式：</label>
					    	<div class="layui-input-block">
					      		<input type="radio" name="artificial" value="1" lay-filter="artificial" title="开启"  {if $regulation->artificial == 1} checked{/if}>
					      		<input type="radio" name="artificial" id="artificial" value="2" lay-filter="artificial" title="关闭"  {if $regulation->artificial == 2} checked{/if} {if !$regulation->id}checked{/if}>
					    	</div>
					  	</div>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn" type="button" onclick="regulation()">立即提交</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
			</div>	
		</div>	
	</form>
</body>
<script src="/cdn/jquery.min.js"></script>
<script src="/layui/layui.all.js"></script>
<script src="/js/ajax.js"></script>
<script type="text/javascript">
layui.use('form', function(){
  	var form = layui.form;
  	form.on('radio(noopsyche)', function (data) {
        if ($('input[name="noopsyche"]:checked').val() == "1"){
            // $("#queue").prop("checked",true);
            $("#artificial").prop("checked",true);
        }
        form.render();
    });
    // form.on('radio(queue)', function (data) {
    //     if ($('input[name="queue"]:checked').val() == "1"){
    //         $("#noopsyche").prop("checked",true);
    //         $("#artificial").prop("checked",true);
    //     }
    //     form.render();
    // });
    form.on('radio(artificial)', function (data) {
        if ($('input[name="artificial"]:checked').val() == "1"){
            // $("#queue").prop("checked",true);
            $("#noopsyche").prop("checked",true);
        }
        form.render();
    });
});

function regulation(){
	var noopsyche = $('input[name="noopsyche"]:checked').val();
	var artificial = $('input[name="artificial"]:checked').val();
	// var queue = $('input[name="queue"]:checked').val();
	if(noopsyche ==2 && artificial == 2){
		tusi("至少选择一项");
		return false;
	}
	myAjaxPost(false, true, '',{ artificial,artificial,noopsyche:noopsyche}, function (resp) {
		tusi(resp.msg);
	})
}
</script>
</html>